package com.zombie.util.state.transition;

import com.badlogic.gdx.graphics.Color;
import com.zombie.util.state.State;

public class RotateTransition implements Transition {

	private State prev;
	private float ang;
	private boolean finish;
	private float scale = 1;
	private Color background;

	public RotateTransition() {
		
	}

	public RotateTransition(Color background) {
		this.background = background;
	}
	
	public void init(State firstState, State secondState) {
		prev = secondState;
	}

	public boolean isComplete() {
		return finish;
	}

	public void postRender(){
//		g.translate(container.getWidth()/2, container.getHeight()/2);
//		g.scale(scale,scale);
//		g.rotate(0, 0, ang);
//		g.translate(-container.getWidth()/2, -container.getHeight()/2);
//		if (background != null) {
//			Color c = g.getColor();
//			g.setColor(background);
//			g.fillRect(0,0,container.getWidth(),container.getHeight());
//			g.setColor(c);
//		}
//		prev.render(container, game, g);
//		g.translate(container.getWidth()/2, container.getHeight()/2);
//		g.rotate(0, 0, -ang);
//		g.scale(1/scale,1/scale);
//		g.translate(-container.getWidth()/2, -container.getHeight()/2);
	}

	public void update(float delta) {
		ang += delta*1000 * 0.5f;
		if (ang > 500) {
			finish = true;
		}
		scale -= delta * 0.001f;
		if (scale < 0) {
			scale = 0;
		}
	}

	@Override
	public void preRender() {

	}

	@Override
	public void complete() {

	}


}
